package demo.security.example.model.po;

import com.fasterxml.jackson.annotation.JsonView;
import demo.security.example.model.validator.UserValidatorConstraint;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.Past;
import java.io.Serializable;
import java.util.Date;

/**
 * User
 *
 * @author lidj
 * @date 2018-01-08
 */
@Data
public class User implements Serializable{

    @JsonView(UserSimpleView.class)
    private String userId;

    @JsonView(UserSimpleView.class)
    @UserValidatorConstraint(message = "这是一个测试")
    private String userName;

    @JsonView(UserDetailView.class)
    @NotBlank(message = "密码不能为空")
    private String passWord;

    @JsonView(UserSimpleView.class)
    @Past(message = "生日必须是过去的时间")
    private Date birthday;

    public interface UserSimpleView{}

    public interface UserDetailView extends UserSimpleView{}
}
